/*
 * Copyright © 2021 Dowsure
 * https://www.dowsure.com/
 *
 * All rights reserved.
 */

package com.dowsure.apisaas.util.smalgorithm;

/**
 * @program: dowsure-apis
 * @description:
 * @author: Dowsure
 * @create: 2021-12-09 16:11
 **/
public class SM4KeyPair {

    private String secretKey;
    private String iv;

    private byte [] secretKeyByte;
    private byte [] ivByte;

    public String getSecretKey() {
        return secretKey;
    }

    public void setSecretKey(String secretKey) {
        this.secretKey = secretKey;
    }

    public String getIv() {
        return iv;
    }

    public void setIv(String iv) {
        this.iv = iv;
    }

    public byte[] getSecretKeyByte() {
        return secretKeyByte;
    }

    public void setSecretKeyByte(byte[] secretKeyByte) {
        this.secretKeyByte = secretKeyByte;
    }

    public byte[] getIvByte() {
        return ivByte;
    }

    public void setIvByte(byte[] ivByte) {
        this.ivByte = ivByte;
    }

    @Override
    public String toString() {
        final StringBuffer sb = new StringBuffer("SM4KeyPair{");
        sb.append("secretKey='").append(secretKey).append('\'');
        sb.append(", iv='").append(iv).append('\'');
        sb.append(", secretKeyByte=");
        if (secretKeyByte == null) sb.append("null");
        else {
            sb.append('[');
            for (int i = 0; i < secretKeyByte.length; ++i)
                sb.append(i == 0 ? "" : ", ").append(secretKeyByte[i]);
            sb.append(']');
        }
        sb.append(", ivByte=");
        if (ivByte == null) sb.append("null");
        else {
            sb.append('[');
            for (int i = 0; i < ivByte.length; ++i)
                sb.append(i == 0 ? "" : ", ").append(ivByte[i]);
            sb.append(']');
        }
        sb.append('}');
        return sb.toString();
    }
}
